<?php 
require ("pgfunc.php");
$qstr = $_SERVER['REQUEST_URI'];
$qstr = substr($qstr, 17 + strpos($qstr, $_SERVER['SCRIPT_NAME']));
$TAPIurl = "https://qqfarn.appspot.com/twiauth/API/".$qstr;
$proxyurl = "https://qqfarn.appspot.com/twiauth/";

if($_SERVER['REQUEST_METHOD'] == "GET")
{
	$data = vget($TAPIurl);
	if($data == NULL)
	{
		$data = vget($TAPIurl);
	}
	echo($data);
}
if($_SERVER['REQUEST_METHOD'] == "POST")
{
	$proxyurl = $proxyurl.$qstr;
	$postdata = array();
	foreach($_POST as $k => $v){
		$postdata[$k] = $v;
	}
	if(array_key_exists('status',$postdata))
	{
		$postdata['status'] = "/".stripslashes($postdata['status']);
	}
	$data = vpost($proxyurl, $postdata);
	if($data == NULL)
	{
		$data = vpost($proxyurl, $postdata);
	}
	echo($data);
}
fclose($handle); 
?>